package com.h3c.nem.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum OfferModifyApprovalEnum {
    /**
     * offer信息修改审核
     */
    OFFER_MODIFY_BP_SUBMIT("OFFER_MODIFY_BP_SUBMIT", "BP提交offer变更申请", 50, "APPROVING"),
    OFFER_MODIFY_APPROVAL_GBBZ("OFFER_MODIFY_APPROVAL_GBBZ", "干部部长审批", 51, "APPROVING"),
    OFFER_MODIFY_APPROVAL_MANAGER("OFFER_MODIFY_APPROVAL_MANAGER", "一级主管审批", 52, "APPROVING"),
    OFFER_MODIFY_APPROVAL_RECRUITMENT("OFFER_MODIFY_APPROVAL_RECRUITMENT", "招聘调配部管理员审批", 53, "APPROVING"),
    OFFER_MODIFY_APPROVAL_CHRO("OFFER_MODIFY_APPROVAL_CHRO", "CHRO审批", 54, "APPROVED"),
    ;

    private final String nodeId;
    private final String nodeName;
    private final Integer status;
    private final String todoStatus; //下一环节状态

    public static OfferModifyApprovalEnum getNextNodeId(String nodeId) {
        OfferModifyApprovalEnum approvalEnum = OfferModifyApprovalEnum.valueOf(nodeId);
        if (approvalEnum.nodeId.equals(nodeId)) {
            Integer status = approvalEnum.getStatus();
            return getNodeIdByStatus(status + 1);
        }
        return null;
    }

    public static OfferModifyApprovalEnum getOfferEnumByNodeId(String nodeId) {
        return OfferModifyApprovalEnum.valueOf(nodeId);
    }

    public static Integer getStatusByNodeId(String nodeId) {
        for (OfferModifyApprovalEnum approvalEnum : OfferModifyApprovalEnum.values()) {
            if (approvalEnum.getNodeId().equals(nodeId)) {
                return approvalEnum.getStatus();
            }
        }
        return null;
    }

    public static OfferModifyApprovalEnum getNodeIdByStatus(Integer status) {
        for (OfferModifyApprovalEnum approvalEnum : OfferModifyApprovalEnum.values()) {
            if (approvalEnum.status.equals(status)) {
                return approvalEnum;
            }
        }
        return null;
    }
}
